from django import template

register = template.Library()

def tracked_boxes(pages, tracked):
    boxes = ""
    for page in pages: 
        boxes = boxes + "<tr><td>"+page.title+"</td><td><input type='checkbox' value='"+str(page.id)+"' name='inputTracked[]'"
        if {'page_id':page.id} in tracked:
            boxes = boxes + " checked "   
        boxes = boxes +"></td></tr>"
        
    return boxes

register.simple_tag(tracked_boxes)